fix: handle Schlage masked usercode responses with varying PIN lengths#558
fix: handle Schlage masked usercode responses with varying PIN lengths#558raman325 wants to merge 3 commits intoFutureTense:betafrom
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## beta #558 +/- ##
==========================================
+ Coverage 80.86% 84.57% +3.71%
==========================================
Files 19 25 +6
Lines 2341 2730 +389
==========================================
+ Hits 1893 2309 +416
+ Misses 448 421 -27
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds support for Yale locks which use a different masked usercode format ("0000") compared to Schlage locks ("**********"), and fixes an issue with clearing codes on Schlage locks.
Changes:
- Added Yale masked usercode detection using
len(set(usercode)) == 1to detect any single-character repeated pattern - Improved Z-Wave JS provider's clear operation by moving debug log to else block and returning False on verification failure
- Applied pylint style fixes converting lists to tuples in for loops across multiple files
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
custom_components/keymaster/providers/zwave_js.py |
Improved error handling in async_clear_usercode by moving debug log to else block and returning False on verification failure |
custom_components/keymaster/coordinator.py |
Added support for Yale masked usercode format ("0000") using len(set(usercode)) == 1 check and preventing false positives by comparing with stored PIN |
custom_components/keymaster/__init__.py |
Style fix: converted list to tuple in for loop |
custom_components/keymaster/migrate.py |
Style fix: converted list to tuple in for loop |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
This PR fixes an issue with Schlage locks that have PINs with lengths other than 4 digits. The masked usercode response uses repeated characters (e.g., "**********" or "0000000000") which need to be detected regardless of length.
Breaking change
None.
Proposed change
Coordinator changes (
coordinator.py)len(set(usercode)) == 1to detect any single-character repeated pattern for masked responsesbreakafter clearing usercode to exit loop earlyZ-Wave JS Provider changes (
zwave_js.py)elseblock after successful clear operationFalsewhen verification fails to properly trigger retry logicStyle fixes
forloops (pylint R6102) in:__init__.pycoordinator.pymigrate.pyType of change
Additional information
🤖 Generated with Claude Code